package com.tool.btn;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.come.until.AnalysisString;
import org.come.Jpanel.FrameMessageChangeJpanel;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.come.entity.Goodstable;
import org.come.model.AllConfigure;
import org.come.model.Configure;
import org.come.model.GMshopItem;

import java.math.BigDecimal;
import org.come.bean.SuitOperBean;
import org.come.socket.SendMessageUntil;
import org.come.until.GsonUtil;
import org.come.socket.Agreement;
import org.come.bean.ConfigureBean;
import org.come.bean.GMshopItemBean;
import org.come.bean.NpcComposeBean;
import java.util.ArrayList;
import org.come.until.UserData;
import org.come.until.UserMessUntil;
import org.come.until.AccessSuitMsgUntil;
import org.come.until.Goodtype;
import org.come.until.GoodsListFromServerUntil;
import org.come.Frame.ZhuFrame;
import com.tool.role.RoleData;
import org.come.mouslisten.TransmuteMouslisten;
import org.come.until.Util;
import java.awt.event.MouseEvent;
import java.awt.Font;
import java.awt.Color;
import org.come.Jpanel.RuneOperateJpanel;
import org.come.Jpanel.ForgeJpanel;

public class DazaoBtn extends MoBanBtn
{
    private ForgeJpanel forgeJpanel;
    private RuneOperateJpanel runeOperateJpanel;
    
    public DazaoBtn(final String iconpath, final int type, final Color[] colors, final String text, final Font font, final ForgeJpanel forgeJpanel) {
        super(iconpath, type, colors);
        this.setText(text);
        this.setFont(font);
        this.setVerticalTextPosition(0);
        this.setHorizontalTextPosition(0);
        this.forgeJpanel = forgeJpanel;
    }
    
    public DazaoBtn(final String iconpath, final int type, final Color[] colors, final Font font, final String text, final RuneOperateJpanel runeOperateJpanel) {
        super(iconpath, type, colors);
        this.runeOperateJpanel = runeOperateJpanel;
        this.setText(text);
        this.setFont(font);
        this.setVerticalTextPosition(0);
        this.setHorizontalTextPosition(0);
    }

    @Override
    public void chooseyes() {
    }
    
    @Override
    public void chooseno() {
    }
    
    @Override
    public void nochoose(final MouseEvent e) {
        if (!Util.isCanBuyOrno()) {
            String type;
            BigDecimal money;
            Goodstable[] goods;
            if (this.forgeJpanel != null) {
                type = this.forgeJpanel.getType();
                money = this.forgeJpanel.getMoney1();
                goods = TransmuteMouslisten.goods2;
            }
            else if (this.runeOperateJpanel != null && this.runeOperateJpanel.getRuneType() == 1) {
                type = "我要洗练符石";
                money = this.runeOperateJpanel.getMoney();
                goods = TransmuteMouslisten.goods3;
            }
            else {
                if (this.runeOperateJpanel == null || this.runeOperateJpanel.getRuneType() != 2) {
                    return;
                }
                type = "我要合成符石";
                money = this.runeOperateJpanel.getMoney();
                goods = TransmuteMouslisten.goods4;
            }
            if (RoleData.getRoleData().getLoginResult().getGold().longValue() < money.longValue()) {
                ZhuFrame.getZhuJpanel().addPrompt2("金钱不足");
            }
            else {
                for (Goodstable good : goods) {
                    if (good == null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("请凑齐物品再来");
                        return;
                    }
                    if (good.getGoodlock() == 1) {
                        ZhuFrame.getZhuJpanel().addPrompt2("该物品已被加锁");
                        return;
                    }
                    if (GoodsListFromServerUntil.isExist(good)) {
                        return;
                    }
                    if (Goodtype.EquipmentType(good.getType()) != -1) {
                        if (AccessSuitMsgUntil.getExtra(good.getValue(), BaptizeBtn.Extras[3]) != null) {
                            ZhuFrame.getZhuJpanel().addPrompt2("套装无法用于打造系列");
                            return;
                        }
                        if (AccessSuitMsgUntil.getExtra(good.getValue(), BaptizeBtn.Extras[4]) != null || (good.getQhv() != null && good.getQhv().intValue() > 0)) {
                            ZhuFrame.getZhuJpanel().addPrompt2("已镶嵌宝石无法用于打造系列");
                            return;
                        }
                    }
                }
                if (!this.type(type, goods)) {
                    if (!"我要升级神兵".equals(type) && !"精炼神兵".equals(type)) {
//                        UserData.uptaelByType(money.intValue());
                        final List<BigDecimal> goodstables = (List<BigDecimal>)new ArrayList();
                        for (int j = 0; j < goods.length; ++j) {
                            if (j == 0) {
                                goods[j].setUsetime(0);
                            }
                            else {
                                goods[j].setUsetime(goods[j].getUsetime() - 1);
                            }
                            goodstables.add(goods[j].getRgid());
                            if (goods[j].getUsetime() <= 0) {
                                GoodsListFromServerUntil.Deletebiaoid(goods[j].getRgid());
                                goods[j] = null;
                                this.qkth(type, j);
                            }
                        }
                        final NpcComposeBean npcComposeBean = new NpcComposeBean();
                        npcComposeBean.setComposetype(type);
                        npcComposeBean.setGoodstables(goodstables);
                        final String senmes = Agreement.getAgreement().npccomposeAgreement(GsonUtil.getGsonUtil().getgson().toJson(npcComposeBean));
                        SendMessageUntil.toServer(senmes);
                    }
                    else {
                        RoleData.getRoleData().getLoginResult().setGold(RoleData.getRoleData().getLoginResult().getGold().subtract(money));
                        final SuitOperBean operBean = new SuitOperBean();
                        operBean.setType(16);
                        final List<BigDecimal> rgids = (List<BigDecimal>)new ArrayList();
                        for (int k = 0; k < goods.length; ++k) {
                            if (k == 0) {
                                goods[k].setUsetime(0);
                            }
                            else {
                                goods[k].setUsetime(goods[k].getUsetime() - 1);
                            }
                            rgids.add(goods[k].getRgid());
                            if (goods[k].getUsetime() <= 0) {
                                GoodsListFromServerUntil.Deletebiaoid(goods[k].getRgid());
                                goods[k] = null;
                                this.qkth(type, k);
                            }
                        }
                        operBean.setGoods(rgids);
                        final String senmes = Agreement.suitOperateAgreement(GsonUtil.getGsonUtil().getgson().toJson(operBean));
                        SendMessageUntil.toServer(senmes);
                    }
                }
            }
        }
    }
    
    public void qkth(final String type, final int i) {
        if (this.forgeJpanel != null) {
            this.forgeJpanel.getGoodsListLabel()[i + 24].setIcon(null);
        }
        else if (this.runeOperateJpanel != null && this.runeOperateJpanel.getRuneType() == 1) {
            this.runeOperateJpanel.getGoodsListLabel()[i + 24].setIcon(null);
        }
        else if (this.runeOperateJpanel != null && this.runeOperateJpanel.getRuneType() == 2) {
            this.runeOperateJpanel.getGoodsListLabel()[i + 26].setIcon(null);
        }
    }
    
    public boolean type(final String type, final Goodstable[] goods) {
        if (type != null) {
            if ("我要合成仙器".equals(type)) {
                return this.GoodItem_1(goods);
            }
            if ("我要升级仙器".equals(type)) {
                return this.GoodItem_2(goods);
            }
            if ("我要洗炼仙器".equals(type)) {
                return this.GoodItem_3(goods);
            }
            if ("改变仙器模型".equals(type)) {
                return this.GoodItem_34(goods);
            }
            if ("我要重铸仙器".equals(type)) {
                return this.GoodItem_33(goods);
            }
            if ("打造11级以上高级装备".equals(type)) {
                return this.GoodItem_4(goods);
            }
            if ("我要打造普通装备".equals(type)) {
                return this.GoodItem_5(goods);
            }
            if ("我要升级神兵".equals(type)) {
                return this.GoodItem_6(goods);
            }
            if ("我要合成炼妖石".equals(type)) {
                return this.GoodItem_7(goods);
            }
            if ("我要炼器".equals(type)) {
                return this.GoodItem_8(goods);
            }
            if ("我要培养饰品".equals(type)) {
                return this.GoodItem_9(goods);
            }
            if ("我要解封神饰".equals(type)) {
                return this.GoodItem_35(goods);
            }
            if ("我要重铸饰品".equals(type)) {
                return this.GoodItem_10(goods);
            }
            if ("我要合成符石".equals(type)) {
                return this.GoodItem_11(goods);
            }
            if ("我要洗练符石".equals(type)) {
                return this.GoodItem_12(goods);
            }
            if ("炼化装备".equals(type)) {
                return this.GoodItem_13(goods);
            }
            if ("我要上神兵石".equals(type) || "炼化神兵".equals(type)) {
                return this.GoodItem_14(goods);
            }
            if ("我要培养护身符".equals(type)) {
                return this.GoodItem_15(goods);
            }
            if ("我要重铸护身符".equals(type)) {
                return this.GoodItem_16(goods);
            }
            if ("炼化仙器".equals(type)) {
                return this.GoodItem_17(goods);
            }
            if ("培养彩晶石".equals(type)) {
                return this.GoodItem_18(goods);
            }
            if ("精炼神兵".equals(type)) {
                return this.GoodItem_19(goods);
            }if (type.equals("封印兽魂")) {
                return this.GoodItem_20(goods);
            }
            if (type.equals("洗练兽魂属性")) {
                return this.GoodItem_21(goods);
            }
            if (type.equals("提升兽灵等级")) {
                return this.GoodItem_22(goods);
            }
        }
        return true;
    }
    private boolean GoodItem_20(final Goodstable[] goods) {
        if (this.forgeJpanel.getType().equals("封印兽魂")) {
            final String value = goods[0].getValue();
//            if (value.indexOf("神兵属性") != -1) {
//                FrameMessageChangeJpanel.addtext(6, "该装备已经有上了神兵石了", null, null, null, null, null);
//                return true;
//            }
        }
        return false;
    }
    private boolean GoodItem_21(final Goodstable[] goods) {
        if (this.forgeJpanel.getType().equals("洗练兽魂属性")) {
            final String value = goods[0].getValue();
//            if (value.indexOf("神兵属性") != -1) {
//                FrameMessageChangeJpanel.addtext(6, "该装备已经有上了神兵石了", null, null, null, null, null);
//                return true;
//            }
        }
        return false;
    }
    private boolean GoodItem_22(final Goodstable[] goods) {
        if (this.forgeJpanel.getType().equals("提升兽灵等级")) {
            final String value = goods[0].getValue();
        }
        return false;
    }
    public boolean GoodItem_1(Goodstable[] goods) {
        String Bottletext = goods[0].getValue();
        String[] gongneng = null;
        if (Bottletext != null && !"".equals(Bottletext)) {
            gongneng = Goodtype.StringParsing(Bottletext);
        }

        String god = Goodtype.StringParsing(goods[1].getValue())[0];
        if (gongneng == null) {
            if ("阶数=6".equals(god)) {
                FrameMessageChangeJpanel.addtext(6, "6阶打进瓶子???哎!还是卖太便宜了", null, null);
                return true;
            }
        } else {
            if (!gongneng[0].equals(god)) {
                FrameMessageChangeJpanel.addtext(6, "阶数不相等", null, null);
                return true;
            }

            if (this.ReikiFull(gongneng)) {
                FrameMessageChangeJpanel.addtext(6, "灵气已经满了", null, null);
                return true;
            }

            if (AnalysisString.jiaoyi(goods[0].getQuality()) != AnalysisString.jiaoyi(goods[1].getQuality())) {
                FrameMessageChangeJpanel.addtext(6, "绑定和不绑定不能混合", null, null);
                return true;
            }
        }

        return false;
    }

    /** 我要升级仙器 */
    public boolean GoodItem_2(Goodstable[] goods) {
        String Bottletext = goods[0].getValue();
        String[] gongneng = Goodtype.StringParsing(Bottletext);
        int kslvl = Integer.parseInt(goods[1].getValue().split("=")[1]);
        if ("".equals(gongneng)) {
            FrameMessageChangeJpanel.addtext(6, "瓶子没有灵气", null, null);
            return true;
        } else if (!this.ReikiFull(gongneng)) {
            FrameMessageChangeJpanel.addtext(6, "瓶子灵气未满！", null, null);
            return true;
        } else {
            int lvl = Integer.parseInt(gongneng[0].split("=")[1]);
            if (lvl + 5 != kslvl) {
                FrameMessageChangeJpanel.addtext(6, this.zw(lvl) + "阶仙器请用" + (lvl + 5) + "级矿石升级!", null, null);
                return true;
            } else if (lvl >= 6) {
                FrameMessageChangeJpanel.addtext(6, "未开放六阶仙器升级!", null, null);
                return true;
            } else {
                ++lvl;
                return false;
            }
        }
    }

    public boolean GoodItem_3(final Goodstable[] goods) {
        return false;
    }
    
    public boolean GoodItem_33(final Goodstable[] goods) {
        return false;
    }
    
    public boolean GoodItem_34(final Goodstable[] goods) {
        return false;
    }
    
    public boolean GoodItem_4(final Goodstable[] goods) {
        final int goodid = goods[0].getGoodsid().intValue();
        final int zblvl = Integer.parseInt(goods[0].getValue().split("\\|")[0].split("=")[1]);
        final int kslvl = Integer.parseInt(goods[1].getValue().split("=")[1]);
        if (zblvl < 10) {
            FrameMessageChangeJpanel.addtext(6, "打造1-10级装备去长安城打铁铺找冯铁匠!", null, null);
            return true;
        }
        boolean up = false;
        if (zblvl >= 10 && zblvl <= 13) {
            if (kslvl != 8 && kslvl != 9) {
                FrameMessageChangeJpanel.addtext(6, "打造11-14级装备使用9级矿石!", null, null);
                FrameMessageChangeJpanel.addtext(6, "重铸10-13级装备使用8级矿石!", null, null);
                return true;
            }
            if (kslvl == 9) {
                up = true;
            }
        }
        else if (zblvl == 14) {
            if (kslvl != 9 && kslvl != 10) {
                FrameMessageChangeJpanel.addtext(6, "打造15级装备使用10级矿石!", null, null);
                FrameMessageChangeJpanel.addtext(6, "重铸14级装备使用9级矿石!", null, null);
                return true;
            }
            if (kslvl == 10) {
                up = true;
            }
        }
        else if (zblvl == 15) {
            if (kslvl != 10 && kslvl != 11) {
                FrameMessageChangeJpanel.addtext(6, "打造16级装备使用11级矿石!", null, null);
                FrameMessageChangeJpanel.addtext(6, "重铸15级装备使用10级矿石!", null, null);
                return true;
            }
            if (kslvl == 11) {
                up = true;
            }
        }
        else {
            if (zblvl != 16) {
                FrameMessageChangeJpanel.addtext(6, "错误公式", null, null);
                return true;
            }
            if (kslvl != 11) {
                FrameMessageChangeJpanel.addtext(6, "重铸16级装备使用11级矿石!", null, null);
                return true;
            }
        }
        return false;
    }
    
    public boolean GoodItem_5(final Goodstable[] goods) {
        final int goodid = goods[0].getGoodsid().intValue();
        final int zblvl = Integer.parseInt(goods[0].getValue().split("\\|")[0].split("=")[1]);
        final int kslvl = Integer.parseInt(goods[1].getValue().split("=")[1]);
        if (zblvl >= 10) {
            FrameMessageChangeJpanel.addtext(6, "打造11级以上高级装备去长安桥头!", null, null);
            return true;
        }
        if (kslvl > 9) {
            FrameMessageChangeJpanel.addtext(6, "打造1-10级装备最高只能使用9级矿石!", null, null);
            return true;
        }
        return false;
    }
    
    public boolean GoodItem_6(final Goodstable[] goods) {
        final String Bottletext = goods[0].getValue();
        final String[] gongneng = Goodtype.StringParsing(Bottletext);
        final int godlvl = Numerical(gongneng[0]);
        final int kslvl = Integer.parseInt(goods[1].getValue().split("=")[1]);
        if (godlvl < 1 || godlvl > 12) {
            FrameMessageChangeJpanel.addtext(6, "不支持13级神兵升级!", null, null);
            return true;
        }
        if (godlvl != kslvl - 5) {
            FrameMessageChangeJpanel.addtext(6, "请使用" + (godlvl + 5) + "级矿石进行升级!", null, null);
            return true;
        }
        return false;
    }
    
    public boolean GoodItem_7(final Goodstable[] goods) {
        return false;
    }
    
    public boolean GoodItem_35(final Goodstable[] goods) {
        return false;
    }
    
    public boolean GoodItem_8(final Goodstable[] goods) {
        return true;
    }
    
    public boolean GoodItem_9(final Goodstable[] goods) {
        final String Bottletext = goods[0].getValue();
        final String[] gongneng = Goodtype.StringParsing(Bottletext);
        int max = 0;
        int flvl = 0;
        for (int i = 0; i < gongneng.length; ++i) {
            if (gongneng[i].length() >= 2 && gongneng[i].startsWith("培养")) {
                final String[] num = gongneng[i].split("=")[1].split("/");
                max = Integer.parseInt(num[1]);
            }
        }
        if (max == 0) {
            ZhuFrame.getZhuJpanel().addPrompt2("该配饰无法培养");
            return true;
        }
        if (Goodtype.Accessories(goods[1].getType().longValue())) {
            final String[] vs = goods[1].getValue().split("\\|");
            for (int j = 0; j < vs.length; ++j) {
                final String[] v = vs[j].split("=");
                if ("等级".equals(v[0])) {
                    flvl = Integer.parseInt(v[1]);
                }
            }
            if (flvl > 2) {
                ZhuFrame.getZhuJpanel().addPrompt2("无法用2级以上的配饰培养");
                return true;
            }
        }
        if (Numerical(gongneng[0]) <= 6) {
            return false;
        }
        FrameMessageChangeJpanel.addtext(6, "当前饰品无法升级!", null, null);
        return true;
    }
    
    public boolean GoodItem_10(final Goodstable[] goods) {
        final String Bottletext = goods[0].getValue();
        final String[] gongneng = Goodtype.StringParsing(Bottletext);
        final int kslvl = Integer.parseInt(goods[1].getValue().split("=")[1]);
        if (Numerical(gongneng[0]) == kslvl - 3) {
            return false;
        }
        if (goods[0].getType().longValue() == 928L) {
            return true;
        }
        FrameMessageChangeJpanel.addtext(6, "请使用相应的矿石进行重铸!", null, null);
        return true;
    }
    
    public boolean GoodItem_11(final Goodstable[] goods) {
        int lvl = Numerical(Goodtype.StringParsing(goods[0].getValue())[0]);
        if (lvl >= 5) {
            FrameMessageChangeJpanel.addtext(6, "不支持5级以上合成", null, null);
            return true;
        }
        for (int i = 1; i < goods.length; ++i) {
            if (lvl != Numerical(Goodtype.StringParsing(goods[i].getValue())[0])) {
                FrameMessageChangeJpanel.addtext(6, "合成物品需要同等级", null, null);
                return true;
            }
        }
        ++lvl;
        return false;
    }
    
    public boolean GoodItem_12(final Goodstable[] goods) {
        final int ore_1 = Numerical(Goodtype.StringParsing(goods[0].getValue())[0]);
        final int ore_2 = Numerical(Goodtype.StringParsing(goods[1].getValue())[0]);
        if (ore_1 == 1 || ore_1 == 2 || ore_1 == 3) {
            FrameMessageChangeJpanel.addtext(6, "1,2,3级符石不能洗练", null, null);
            return true;
        }
        if (ore_1 - 3 != ore_2) {
            FrameMessageChangeJpanel.addtext(6, ore_1 + "级符石用" + (ore_1 - 3) + "符石洗练", null, null);
            return true;
        }
        return false;
    }
    
    private boolean GoodItem_13(final Goodstable[] goods) {
        return false;
    }
    
    private boolean GoodItem_14(final Goodstable[] goods) {
        if ("我要上神兵石".equals(this.forgeJpanel.getType())) {
            final String value = goods[0].getValue();
            if (value.indexOf("神兵属性") != -1) {
                FrameMessageChangeJpanel.addtext(6, "该装备已经有上了神兵石了", null, null);
                return true;
            }
        }
        return false;
    }
    
    private boolean GoodItem_15(final Goodstable[] goods) {
        final String[] vs = goods[0].getValue().split("\\|");
        int pz = 0;
        for (int i = 0; i < vs.length; ++i) {
            final String[] vsz = vs[i].split("=");
            if ("品质".equals(vsz[0])) {
                pz = Integer.parseInt(vsz[1].split("/")[0]);
                break;
            }
        }
        int up = 800;
        final String extra = AccessSuitMsgUntil.getExtra(goods[0].getValue(), "炼化属性");
        Label_0182: {
            if (extra != null) {
                final String[] vvs = extra.split("&");
                for (int j = 0; j < vvs.length; ++j) {
                    final String[] vvvs = vvs[j].split("=");
                    if ("特技".equals(vvvs[0])) {
                        for (int k = 1; k < vvvs.length; ++k) {
                            if ("8031".equals(vvvs[k])) {
                                up = 900;
                                break Label_0182;
                            }
                        }
                    }
                }
            }
        }
        if (pz > up) {
            FrameMessageChangeJpanel.addtext(6, "该护身符品质大于" + up + "后无法培养", null, null);
            return true;
        }
        return false;
    }
    
    private boolean GoodItem_16(final Goodstable[] goods) {
        final String[] vs = goods[0].getValue().split("\\|");
        int pz = 0;
        for (int kslvl = 0; kslvl < vs.length; ++kslvl) {
            final String[] vsz = vs[kslvl].split("=");
            if ("品质".equals(vsz[0])) {
                pz = Integer.parseInt(vsz[1].split("/")[0]);
                break;
            }
        }
        if (pz < 300) {
            FrameMessageChangeJpanel.addtext(6, "该护身符品质低于300的需要培养", null, null);
            return true;
        }
        int kslvl = Integer.parseInt(goods[1].getValue().split("=")[1]);
        if (kslvl != 9 && kslvl != 10) {
            FrameMessageChangeJpanel.addtext(6, "护身符重铸使用9级矿石!", null, null);
            FrameMessageChangeJpanel.addtext(6, "护身符升级使用10级矿石!", null, null);
            return true;
        }
        int lvl = Integer.parseInt(goods[0].getValue().split("\\|")[0].split("=")[1]);
        if (kslvl == 10 && ++lvl > 10) {
            FrameMessageChangeJpanel.addtext(6, "护身符等级最高为10级", null, null);
            return true;
        }
        return false;
    }
    
    private boolean GoodItem_17(final Goodstable[] goods) {
        if (goods[1].getType().longValue() == 7005L) {
            final String god = Goodtype.StringParsing(goods[1].getValue())[1];
            if (!"阶数=1".equals(god)) {
                FrameMessageChangeJpanel.addtext(6, "使用一阶作为炼化材料太掉价了吗?", null, null);
                return true;
            }
        }
        else {
            final String god = Goodtype.StringParsing(goods[1].getValue())[0];
            if (!"阶数=1".equals(god)) {
                FrameMessageChangeJpanel.addtext(6, "使用一阶作为炼化材料太掉价了吗?", null, null);
                return true;
            }
        }
        return false;
    }
    
    private boolean GoodItem_18(final Goodstable[] goods) {
        return false;
    }
    
    private boolean GoodItem_19(final Goodstable[] goods) {
    	ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
		Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
		Configure configure = item.get(new BigDecimal(1));
    	
        final String Bottletext = goods[0].getValue();
        final String[] gongneng = Goodtype.StringParsing(Bottletext);
        final int godlvl = Numerical(gongneng[0]);
        if (godlvl < 1 || godlvl >= Integer.parseInt(configure.getSbzddj())) {
            FrameMessageChangeJpanel.addtext(6, "暂不支持#R"+Integer.parseInt(configure.getSbzddj())+"级#Y神兵升级!", null, null);
            return true;
        }
        if (godlvl < Integer.parseInt(configure.getSbjldj())) {
            FrameMessageChangeJpanel.addtext(6, Integer.parseInt(configure.getSbjldj())+"级及以上的神兵才可以精练", null, null);
            return true;
        }
        final int godlvl2 = Numerical(goods[1].getValue().split("\\|")[0]);
        if (godlvl2 > 3) {
            FrameMessageChangeJpanel.addtext(6, "用3级以下的神兵精练", null, null);
            return true;
        }
        return false;
    }
    
    public int zblvl(final int id) {
        return (id - 1001) % 16 + 1;
    }
    //仙器升级
    public boolean ReikiFull(String[] vlaue) {
        if ("阶数=1".equals(vlaue[0]) || "阶数=2".equals(vlaue[0])) {
            if (Reikisum(vlaue[1]) >= 8) {
                return true;
            }
        } else if ("阶数=3".equals(vlaue[0])) {
            if (Reikisum(vlaue[1]) >= 6) {
                return true;
            }
        } else if ("阶数=4".equals(vlaue[0])) {
            if (Reikisum(vlaue[1]) >= 5) {
                return true;
            }
        } else {
            if (Reikisum(vlaue[1]) >= 3) {
                return true;
            }
        }
        return false;
    }
    
    public String zw(final int lvl) {
        switch (lvl) {
            case 1: {
                return "一";
            }
            case 2: {
                return "二";
            }
            case 3: {
                return "三";
            }
            case 4: {
                return "四";
            }
            case 5: {
                return "五";
            }
            case 6: {
                return "六";
            }
            case 7: {
                return "七";
            }
            case 8: {
                return "八";
            }
            case 9: {
                return "九";
            }
            case 10: {
                return "十";
            }
            default: {
                return "零";
            }
        }
    }
    
    public static int Numerical(final String vlaue) {
        return (vlaue.split("\\=").length == 1) ? 0 : Integer.parseInt(vlaue.split("\\=")[1]);
    }

    final Pattern pattern = Pattern.compile("=(.*?)点");

    public int Reikisum(final String vlaue) {
        final Matcher m = pattern.matcher((CharSequence)vlaue);
        if (m.find()) {
            final int i = 1;
            return Integer.parseInt(m.group(i));
        }
        return 0;
    }
}
